#include "vk_uniform_buffer.h"


namespace vkrender
{
	VulkanUniformBuffer::VulkanUniformBuffer(
		const std::shared_ptr<VulkanDeviceContext>& context,
		VkDeviceSize size)
	{
		this->context = context;
		createBuffer(size);
	}

	void VulkanUniformBuffer::createBuffer(VkDeviceSize size)
	{
		context->createBuffer(
			size,
			VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
			VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
			buffer, memory);
		vkMapMemory(context->device, memory, 0, size, 0, &mapped);
	}

}
